home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1995-08-10 | 13.8 KB | 329 lines | [ TEXT/MPS ]
(* File: TextServices.mod Contains: Text Services Manager Interfaces. Version: Technology: System 7.5 Package: Universal Interfaces 2.0 in “MPW Latest” on ETO #17 Copyright: © 1984-1995 by Apple Computer, Inc. All rights reserved. Bugs?: If you find a problem with this file, use the Apple Bug Reporter stack. Include the file and version information (from above) in the problem description and send to: Internet: apple.bugs.applelink.apple.com AppleLink: APPLE.BUGS *) (*$TAGS-*) (*$CALLING PASCAL*) MODULE TextServices; IMPORT SYSTEM, Types, Quickdraw, Events, Menus, AppleEvents, Components; (* $PUSH*) (* $ALIGN MAC68K*) (* $LibExport+*) CONST kTSMVersion* = $200; (* Version of the Text Services Manager is 2.0 *) kTextService* = LONG("tsvc"); (* component type for the component description *) kInputMethodService* = LONG("inpm"); (* component subtype for the component description *) (* Components.Component Flags in Components.ComponentDescription *) bTakeActiveEvent* = 15; (* bit set if the component takes active event *) bHandleAERecording* = 16; (* bit set if the component takes care of recording Apple Events <new in vers2.0> *) bScriptMask* = $00007F00; (* bit 8 - 14 *) bLanguageMask* = $000000FF; (* bit 0 - 7 *) bScriptLanguageMask* = bScriptMask + bLanguageMask; (* bit 0 - 14 *) (* Hilite styles *) kCaretPosition* = 1; (* specify caret position *) kRawText* = 2; (* specify range of raw text *) kSelectedRawText* = 3; (* specify range of selected raw text *) kConvertedText* = 4; (* specify range of converted text *) kSelectedConvertedText* = 5; (* specify range of selected converted text *) (* Apple Event constants *) (* Event class *) kTextServiceClass* = kTextService; (* event AIFF.ID *) kUpdateActiveInputArea* = LONG("updt"); (* update the active Inline area *) kPos2Offset* = LONG("p2st"); (* converting global coordinates to char position *) kOffset2Pos* = LONG("st2p"); (* converting char position to global coordinates *) kShowHideInputWindow* = LONG("shiw"); (* show or hide the input window *) (* Event keywords *) keyAETSMDocumentRefcon* = LONG("refc"); (* TSM document refcon, typeLongInteger *) (* Note: keyAETSMScriptTag, keyAERequestedType, keyAETSMTextFont, keyAETextPointSize typeAEText, typeIntlWritingCode, typeQDPoint, and keyAEAngle have been moved to AERegistry.h *) keyAEServerInstance* = LONG("srvi"); (* component instance *) keyAETheData* = LONG("kdat"); (* typeText *) keyAEFixLength* = LONG("fixl"); (* fix len ?? *) keyAEHiliteRange* = LONG("hrng"); (* hilite range array *) keyAEUpdateRange* = LONG("udng"); (* update range array *) keyAEClauseOffsets* = LONG("clau"); (* Clause Offsets array *) keyAECurrentPoint* = LONG("cpos"); (* current point *) keyAEDragging* = LONG("bool"); (* dragging falg *) keyAEOffset* = LONG("ofst"); (* offset *) keyAERegionClass* = LONG("rgnc"); (* region class *) keyAEPoint* = LONG("gpos"); (* current point *) keyAEBufferSize* = LONG("buff"); (* buffer size to get the text *) keyAEMoveView* = LONG("mvvw"); (* move view flag *) keyAELength* = LONG("leng"); (* length *) keyAENextBody* = LONG("nxbd"); (* next or previous body *) (* optional keywords for Offset2Pos (Info about the active input area) *) keyAETextLineHeight* = LONG("ktlh"); (* typeShortInteger *) keyAETextLineAscent* = LONG("ktas"); (* typeShortInteger *) (* optional keywords for Pos2Offset *) keyAELeftSide* = LONG("klef"); (* type Boolean *) (* optional keywords for kShowHideInputWindow *) keyAEShowHideInputWindow* = LONG("shiw"); (* type Boolean *) (* for PinRange *) keyAEPinRange* = LONG("pnrg"); (* Desc type ... *) typeComponentInstance* = LONG("cmpi"); (* server instance *) typeTextRangeArray* = LONG("tray"); (* text range array *) typeOffsetArray* = LONG("ofay"); (* offset array *) typeText* = AppleEvents.typeChar; (* Plain text *) typeTextRange* = LONG("txrn"); (* Desc type constants *) kTSMOutsideOfBody* = 1; kTSMInsideOfBody* = 2; kTSMInsideOfActiveInputArea* = 3; kNextBody* = 1; kPreviousBody* = 2; (* typeTextRange LONG("txrn") *) TYPE TextRange* = RECORD fStart*: LONGINT; fEnd*: LONGINT; fHiliteStyle*: INTEGER; END; TextRangePtr* = POINTER TO TextRange; TextRangeHandle* = HANDLE TO TextRange (*ΔΔ POINTER TO TextRangePtr*); (* typeTextRangeArray LONG("txra") *) TextRangeArray* = RECORD fNumOfRanges*: INTEGER; (* specify the size of the fRange array *) fRange*: ARRAY 1 (*ΔΔ[0..0]ΔΔ*) OF TextRange; (* when fNumOfRanges > 1, the size of this array has to be calculated *) END; TextRangeArrayPtr* = POINTER TO TextRangeArray; TextRangeArrayHandle* = HANDLE TO TextRangeArray (*ΔΔ POINTER TO TextRangeArrayPtr*); (* typeOffsetArray LONG("offa") *) OffsetArray* = RECORD fNumOfOffsets*: INTEGER; (* specify the size of the fOffset array *) fOffset*: ARRAY 1 (*ΔΔ[0..0]ΔΔ*) OF LONGINT; (* when fNumOfOffsets > 1, the size of this array has to be calculated *) END; OffsetArrayPtr* = POINTER TO OffsetArray; OffsetArrayHandle* = HANDLE TO OffsetArray (*ΔΔ POINTER TO OffsetArrayPtr*); TSMDocumentID* = Types.Ptr; InterfaceTypeList* = ARRAY 1 (*ΔΔ[0..0]ΔΔ*) OF Types.OSType; (* Text Service Info List *) TextServiceInfo* = RECORD fComponent*: Components.Component; fItemName*: Types.Str255; END; TextServiceInfoPtr* = POINTER TO TextServiceInfo; TextServiceList* = RECORD fTextServiceCount*: INTEGER; (* number of entries in the 'fServices' array *) fServices*: ARRAY 1 (*ΔΔ[0..0]ΔΔ*) OF TextServiceInfo; (* Note: array of 'TextServiceInfo' records follows *) END; TextServiceListPtr* = POINTER TO TextServiceList; TextServiceListHandle* = HANDLE TO TextServiceList (*ΔΔ POINTER TO TextServiceListPtr*); ScriptLanguageRecord* = RECORD fScript*: Types.ScriptCode; fLanguage*: Types.LangCode; END; ScriptLanguageSupport* = RECORD fScriptLanguageCount*: INTEGER; (* number of entries in the 'fScriptLanguageArray' array *) fScriptLanguageArray*: ARRAY 1 (*ΔΔ[0..0]ΔΔ*) OF ScriptLanguageRecord; (* Note: array of 'ScriptLanguageRecord' records follows *) END; ScriptLanguageSupportPtr* = POINTER TO ScriptLanguageSupport; ScriptLanguageSupportHandle* = HANDLE TO ScriptLanguageSupport (*ΔΔ POINTER TO ScriptLanguageSupportPtr*); CONST (* Low level routines which are dispatched directly to the Components.Component Manager *) kCMGetScriptLangSupport* = $0001; (* Components.Component Manager call selector 1 *) kCMInitiateTextService* = $0002; (* Components.Component Manager call selector 2 *) kCMTerminateTextService* = $0003; (* Components.Component Manager call selector 3 *) kCMActivateTextService* = $0004; (* Components.Component Manager call selector 4 *) kCMDeactivateTextService* = $0005; (* Components.Component Manager call selector 5 *) kCMTextServiceEvent* = $0006; (* Components.Component Manager call selector 6 *) kCMGetTextServiceMenu* = $0007; (* Components.Component Manager call selector 7 *) kCMTextServiceMenuSelect* = $0008; (* Components.Component Manager call selector 8 *) kCMFixTextService* = $0009; (* Components.Component Manager call selector 9 *) kCMSetTextServiceCursor* = $000A; (* Components.Component Manager call selector 10 *) kCMHidePaletteWindows* = $000B; (* Components.Component Manager call selector 11 *) (* High level TSM routines *) PROCEDURE NewTSMDocument*(numOfInterface: INTEGER; VAR supportedInterfaceTypes: InterfaceTypeList; VAR idocID: TSMDocumentID; refcon: LONGINT): Types.OSErr; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $7000, $AA54; (*$END*) PROCEDURE DeleteTSMDocument*(idocID: TSMDocumentID): Types.OSErr; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $7001, $AA54; (*$END*) PROCEDURE ActivateTSMDocument*(idocID: TSMDocumentID): Types.OSErr; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $7002, $AA54; (*$END*) PROCEDURE DeactivateTSMDocument*(idocID: TSMDocumentID): Types.OSErr; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $7003, $AA54; (*$END*) PROCEDURE TSMEvent*(VAR event: Events.EventRecord): BOOLEAN; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $7004, $AA54; (*$END*) PROCEDURE TSMMenuSelect*(menuResult: LONGINT): BOOLEAN; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $7005, $AA54; (*$END*) PROCEDURE SetTSMCursor*(mousePos: Types.Point): BOOLEAN; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $7006, $AA54; (*$END*) PROCEDURE FixTSMDocument*(idocID: TSMDocumentID): Types.OSErr; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $7007, $AA54; (*$END*) PROCEDURE GetServiceList*(numOfInterface: INTEGER; VAR supportedInterfaceTypes: Types.OSType; VAR serviceInfo: TextServiceListHandle; VAR seedValue: LONGINT): Types.OSErr; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $7008, $AA54; (*$END*) PROCEDURE OpenTextService*(idocID: TSMDocumentID; aComponent: Components.Component; VAR aComponentInstance: Components.ComponentInstance): Types.OSErr; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $7009, $AA54; (*$END*) PROCEDURE CloseTextService*(idocID: TSMDocumentID; aComponentInstance: Components.ComponentInstance): Types.OSErr; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $700A, $AA54; (*$END*) PROCEDURE SendAEFromTSMComponent*((*CONST*)VAR theAppleEvent: AppleEvents.AppleEvent; VAR reply: AppleEvents.AppleEvent; sendMode: AppleEvents.AESendMode; sendPriority: AppleEvents.AESendPriority; timeOutInTicks: LONGINT; idleProc: AppleEvents.AEIdleUPP; filterProc: AppleEvents.AEFilterUPP): Types.OSErr; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $700B, $AA54; (*$END*) PROCEDURE InitTSMAwareApplication*(): Types.OSErr; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $7014, $AA54; (*$END*) PROCEDURE CloseTSMAwareApplication*(): Types.OSErr; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $7015, $AA54; (*$END*) (* Utilities *) PROCEDURE SetDefaultInputMethod*(ts: Components.Component; VAR slRecordPtr: ScriptLanguageRecord): Types.OSErr; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $700C, $AA54; (*$END*) PROCEDURE GetDefaultInputMethod*(VAR ts: Components.Component; VAR slRecordPtr: ScriptLanguageRecord): Types.OSErr; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $700D, $AA54; (*$END*) PROCEDURE SetTextServiceLanguage*(VAR slRecordPtr: ScriptLanguageRecord): Types.OSErr; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $700E, $AA54; (*$END*) PROCEDURE GetTextServiceLanguage*(VAR slRecordPtr: ScriptLanguageRecord): Types.OSErr; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $700F, $AA54; (*$END*) PROCEDURE UseInputWindow*(idocID: TSMDocumentID; useWindow: BOOLEAN): Types.OSErr; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $7010, $AA54; (*$END*) PROCEDURE NewServiceWindow*(wStorage: (*ΔΔUNIVΔΔ*) Types.Ptr; (*CONST*)VAR boundsRect: Types.Rect; title: Types.ConstStr255Param; visible: BOOLEAN; theProc: INTEGER; behind: Quickdraw.WindowPtr; goAwayFlag: BOOLEAN; ts: Components.ComponentInstance; VAR window: Quickdraw.WindowPtr): Types.OSErr; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $7011, $AA54; (*$END*) PROCEDURE CloseServiceWindow*(window: Quickdraw.WindowPtr): Types.OSErr; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $7012, $AA54; (*$END*) PROCEDURE GetFrontServiceWindow*(VAR window: Quickdraw.WindowPtr): Types.OSErr; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $7013, $AA54; (*$END*) PROCEDURE FindServiceWindow*(thePoint: Types.Point; VAR theWindow: Quickdraw.WindowPtr): INTEGER; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $7017, $AA54; (*$END*) (* Low level TSM routines *) PROCEDURE GetScriptLanguageSupport*(ts: Components.ComponentInstance; VAR scriptHdl: ScriptLanguageSupportHandle): Components.ComponentResult; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $2F3C, $04, $0001, $7000, $A82A; (*$END*) PROCEDURE InitiateTextService*(ts: Components.ComponentInstance): Components.ComponentResult; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $2F3C, $00, $0002, $7000, $A82A; (*$END*) PROCEDURE TerminateTextService*(ts: Components.ComponentInstance): Components.ComponentResult; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $2F3C, $00, $0003, $7000, $A82A; (*$END*) PROCEDURE ActivateTextService*(ts: Components.ComponentInstance): Components.ComponentResult; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $2F3C, $00, $0004, $7000, $A82A; (*$END*) PROCEDURE DeactivateTextService*(ts: Components.ComponentInstance): Components.ComponentResult; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $2F3C, $00, $0005, $7000, $A82A; (*$END*) PROCEDURE TextServiceEvent*(ts: Components.ComponentInstance; numOfEvents: INTEGER; VAR event: Events.EventRecord): Components.ComponentResult; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $2F3C, $06, $0006, $7000, $A82A; (*$END*) PROCEDURE GetTextServiceMenu*(ts: Components.ComponentInstance; VAR serviceMenu: Menus.MenuHandle): Components.ComponentResult; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $2F3C, $4, $0007, $7000, $A82A; (*$END*) PROCEDURE TextServiceMenuSelect*(ts: Components.ComponentInstance; serviceMenu: Menus.MenuHandle; item: INTEGER): Components.ComponentResult; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $2F3C, $06, $0008, $7000, $A82A; (*$END*) PROCEDURE FixTextService*(ts: Components.ComponentInstance): Components.ComponentResult; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $2F3C, $00, $0009, $7000, $A82A; (*$END*) PROCEDURE SetTextServiceCursor*(ts: Components.ComponentInstance; mousePos: Types.Point): Components.ComponentResult; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $2F3C, $04, $000A, $7000, $A82A; (*$END*) PROCEDURE HidePaletteWindows*(ts: Components.ComponentInstance): Components.ComponentResult; (*$IF NOT GENERATINGCFM*) INLINE PASCAL $2F3C, $00, $000B, $7000, $A82A; (*$END*) (* $ALIGN RESET*) (* $POP*) END TextServices.